package Com.HupochuanAdmin.Dal.Tab;

import java.util.Hashtable;

import Com.Hupochuan.Dal.DBManager.DBManager;
import Com.Hupochuan.Vo.Admin;

public class AdminTab {
	/*
	 * 本类私有对象
	 */
	private DBManager<Admin> dbManager = new DBManager<Admin>(Admin.class);
	
	/*
	 * 单一实例
	 */
	private AdminTab(){}
	private static AdminTab adminTab = new AdminTab();
	public static AdminTab getObject(){
		return adminTab;
	}
	
	/*
	 * 获得管理员对象
	 */
	public Admin findAdmin(String name,String pass){
		//参数部分
		Admin admin = null;
		StringBuffer sqlBuff = new StringBuffer();
		Hashtable<String,Object> paraHash = new Hashtable<String,Object>();
		
		//sql语句部分
		sqlBuff.append(" select * from Admin where name=${name} and pass=${pass} ");
		
		//sql参数部分
		paraHash.put("name",name);
		paraHash.put("pass",pass);
		
		//执行sql 
		admin = this.dbManager.querySqlReturnVo(sqlBuff.toString(), paraHash);
		
		//返回列表
		return admin;
	}
}
